package aircraft_war;

import javax.imageio.ImageIO;
import java.io.IOException;

public class Bee extends BasicClass{
    int speed,speed_x;
    //boolean flag=true;

    @Override
    public void move() {
        //x++,y++如果达到阈值，x--，y++
        //如果private     setY(getY()+=speed);
        if(x>=Main.WIDTH-width){
            this.speed_x=-speed_x;
        }
        else if(x<=0){
            this.speed_x=-speed_x;
        }
        y+=speed;
        x+=speed_x;
    }
    public Bee(){
        //super(20);
        img=Main.bee;
        speed=5;
        speed_x=6;
        width=img.getWidth();
        height=img.getHeight();
        blood=1;
        x=(int)(Math.random()*(Main.WIDTH-width));
        y=-height;
        //y=25;

    }
}
